<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/6/7
  Time: 22:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div id="page_nav">
    <!--页码大于首页,才会显示首页与上一页-->
    <!--c:if中的test中判断不能有空格,否则会判断失败-->
    <c:if test="${requestScope.page.pageNo>1}">
        <a href="${requestScope.page.url}&pageNo=1">首页</a>
        <a href="${requestScope.page.url}&pageNo=${requestScope.page.pageNo-1}">上一页</a>
        <a href="${requestScope.page.url}&pageNo=${requestScope.page.pageNo-1}">${requestScope.page.pageNo-1}</a>
    </c:if>

    【${requestScope.page.pageNo}】

    <!--页码小于末页,才会显示末页与下一页-->
    <c:if test="${requestScope.page.pageNo<requestScope.page.pageTotal}">
        <a href="${requestScope.page.url}&pageNo=${requestScope.page.pageNo+1}">${requestScope.page.pageNo+1}</a>
        <a href="${requestScope.page.url}&pageNo=${requestScope.page.pageNo+1}">下一页</a>
        <a href="${requestScope.page.url}&pageNo=${requestScope.page.pageTotal}">末页</a>
    </c:if>
    共${requestScope.page.pageTotal}页，${requestScope.page.pageTotalCount}条记录 到第<input value="${requestScope.page.pageNo}" name="pn" id="pn_input"/>页
    <input type="button" value="确定" id="searchPageBtn">
    <script type="text/javascript">
        $(function(){
            //跳到指定的页码
            $("#searchPageBtn").click(function(){
                var pageNo = $("#pn_input").val();
                if(pageNo<${requestScope.page.pageTotal}){
                    location.href = "${pageScope.basePath}${requestScope.page.url}&pageNo="+pageNo;
                }else{
                    alert("超出页码范围");
                }
            })
        })
    </script>
</div>
